home *** CD-ROM | disk | FTP | other *** search
/ Chip Hitware 7 A / CHIP_HITWARE_7A.iso / internet / Webmaster / _SETUP.4 / Group3 / IE4 clock.jav < prev    next >
Text File  |  1998-12-30  |  1KB  |  56 lines

  1. <!---BeginTitle--->Real time DHTML Clock<!---BeginJAVHead---><!---BeginJAVBody---><div id=Clock align=center style="font-family: Verdana; font-size: 40; color:#0000FF">á</div>
  2.  
  3. <script>
  4. /*Real time DHTML Clock By Paul Swonger AKA "PSYCO" written exclusively for use on the "HTMLGOODIES" website. Feel free to distribute freely (as long as credit is given).*/
  5.  
  6.  
  7. function tick() {
  8.   var hours, minutes, seconds, ap;
  9.   var intHours, intMinutes, intSeconds;
  10.   var today;
  11.  
  12.   today = new Date();
  13.  
  14.   intHours = today.getHours();
  15.   intMinutes = today.getMinutes();
  16.   intSeconds = today.getSeconds();
  17.  
  18.   if (intHours == 0) {
  19.      hours = "12:";
  20.      ap = "Midnight";
  21.   } else if (intHours < 12) { 
  22.      hours = intHours+":";
  23.      ap = "A.M.";
  24.   } else if (intHours == 12) {
  25.      hours = "12:";
  26.      ap = "Noon";
  27.   } else {
  28.      intHours = intHours - 12
  29.      hours = intHours + ":";
  30.      ap = "P.M.";
  31.   }
  32.  
  33.   if (intMinutes < 10) {
  34.      minutes = "0"+intMinutes+":";
  35.   } else {
  36.      minutes = intMinutes+":";
  37.   }
  38.  
  39.   if (intSeconds < 10) {
  40.      seconds = "0"+intSeconds+" ";
  41.   } else {
  42.      seconds = intSeconds+" ";
  43.   } 
  44.  
  45.   timeString = hours+minutes+seconds+ap;
  46.  
  47.   Clock.innerHTML = timeString;
  48.  
  49.   window.setTimeout("tick();", 100);
  50. }
  51.  
  52. window.onload = tick;
  53.  
  54. </script>
  55. <P><!--EndJAVBody-->
  56.